
<?php

require_once '../classes/includeAll.php';
require '../resources/getConnection.php';

$supplierClass = new Suppliers($connection);
$allSuppliers = $supplierClass->getAllSuppliers();

$connection->disconnectDB();
$head='<link rel="stylesheet" type="text/css" href="../design/css/supplier.css">'
      .'<script src="../javascript/pagesJavascript/supplier.js" type="text/javascript"></script>';
$title="Lieferanten";

require '../menu/head.php';
echo '<h1>Lieferanten</h1>';
echo '<div id="tableDiv"><table id="supplierTable">';
echo '<thead><th>Name</th><th>Service e-mail</th><th>Verk&auml;ufer e-mail</th><th>Notiz</th><th></th></thead><tbody>';
foreach ($allSuppliers as $supplier) {  
  echo '<tr>';
  echo '<td>'.sanitizeOutputString($supplier["name"]).'</td>';
  echo '<td>'.$supplier["contactService"].'</td>';
  echo '<td>'.$supplier["contactSalesOffice"].'</td>';
  echo '<td>'.sanitizeOutputString($supplier["note"]).'</td>';
  echo '<td supplier="'.$supplier["ID"].'"><img src="../design/pictures/delete.png" width="20" alt="X"/></td>';
  echo '</tr>';
}
echo '</tbody></table></div>'; ?>
<div id="formDiv">
  <h2>Neuen Lieferanten hinzuf&uuml;gen</h2>
  <form name="add" id="newForm" method="POST">
    <table id="newFormTable">
      <tbody>
        <tr>
          <td><input type="text" name="name" value="" class="inputBoxes" placeholder="Name" /></td>
          <td></td>
        </tr>
        <tr>
          <td><input type="text" name="contactService" value="" class="inputBoxes" placeholder="Service e-mail" /></td>
          <td></td>
        </tr>
        <tr>
          <td><input type="text" name="contactSalesOffice" value="" class="inputBoxes" placeholder="Verk&auml;ufer e-mail" /></td>
          <td></td>
        </tr>
        <tr>
          <td><input type="text" name="note" value="" class="inputBoxes" placeholder="Notiz" /></td>
          <td></td>
        </tr>
        <tr>
          <td><input type="button" value="&Uuml;bernehmen" name="addSupplier" id="addSupplier" /></td>
          <td></td>
        </tr>
      </tbody>
    </table>

  </form>
</div>
<?php
require '../menu/footer.php';